﻿using System.Collections.Generic;
using System.Threading.Tasks;
using SDCloudSolution.SDCloud.Entities;
using SDCloudSolution.SDCloud.Entities.Models;

namespace SDCloudSolution.SDCloud.DataLayer.Model.Interfaces
{
    /// <summary>
    /// Provides a methods for works with models storage.
    /// </summary>
    public interface IModelDataProvider
    {
        /// <summary>
        /// Gets a model entity by identifier.
        /// </summary>
        /// <param name="modelId">The model identifier.</param>
        Task<ModelEntity> GetByIdAsync(int modelId);

        /// <summary>
        /// Gets a list of all models by specific user identifier.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        Task<IEnumerable<ModelEntity>> GetByUserIdAsync(int userId);

        /// <summary>
        /// Gets the list of all models that related to specific public model asynchronous.
        /// </summary>
        /// <param name="publicModelId">The public model identifier.</param>
        Task<IEnumerable<ModelEntity>> GetByPublicModelIdAsync(int publicModelId);

        /// <summary>
        /// Gets a collection with paging of models by specific user identifier.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="paging">The paging.</param>
        Task<EntityCollection<ModelEntity>> GetByUserIdAsync(int userId, Paging paging);

        /// <summary>
        /// Gets the public models asynchronous.
        /// </summary>
        /// <param name="paging">The paging.</param>
        Task<EntityCollection<ModelEntity>> GetPublicModelsAsync(Paging paging);

        /// <summary>
        /// Gets the count of model copies for specific user.
        /// </summary>
        /// <param name="originalModelId">The original model identifier.</param>
        /// <param name="userId">The user identifier.</param>
        Task<int> GetCountOfModelCopiesForUser(int originalModelId, int userId);

        /// <summary>
        /// Gets the count of model copies.
        /// </summary>
        /// <param name="originalModelId">The original model identifier.</param>
        Task<int> GetCountOfModelCopies(int originalModelId);

        /// <summary>
        /// Insert a new model entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        Task InsertAsync(ModelEntity entity);

        /// <summary>
        /// Updates an exists model entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        Task UpdateAsync(ModelEntity entity);

        Task DeleteAsync(ModelEntity entity);
    }
}
